package com.bbtShop.api;

import com.bbtShop.aop.Login;
import com.bbtShop.core.model.*;
import com.bbtShop.service.PaySourceService;
import com.bbtShop.service.SalesHandRecodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : manke
 * @Description
 * @Date: 2020/10/24 16:09
 */
@Api(value = "SalesHandRecodeController", description = "伴手礼员工销售记录")
@RestController
@RequestMapping("/SalesHandRecode")
public class SalesHandRecodeController {

    @Autowired
    private SalesHandRecodeService salesHandRecodeService;

    @ApiOperation(value = "getList", notes = "获取伴手礼员工销售列表")
    @PostMapping("/getList")
    @Login(permission = "SalesHandRecode:getList")
    public ApiResponse<Object> getList(@RequestParam(required = false) Integer pageNum,
                                       @RequestParam(required = false) Integer pageSize,
                                       @RequestBody SalesHandUserNameView salesHandUserNameView) {
        return ApiResponse.success(salesHandRecodeService.getList(pageNum, pageSize, salesHandUserNameView));
    }

    @ApiOperation(value = "getListMonth", notes = "按月获取伴手礼员工销售列表")
    @PostMapping("/getListMonth")
    @Login(permission = "SalesHandRecode:getListMonth")
    public ApiResponse<Object> getListMonth(@RequestParam(required = false) Integer pageNum,
                                            @RequestParam(required = false) Integer pageSize,
                                            @RequestBody SalesHandRecodeView salesHandRecodeView) {
        return ApiResponse.success(salesHandRecodeService.getListMonth(pageNum, pageSize, salesHandRecodeView));
    }

    @ApiOperation(value = "addUpdate", notes = "添加修改伴手礼员工销售")
    @PostMapping("/addUpdate")
    @Login(permission = "SalesHandRecode:addUpdate")
    public ApiResponse<Object> addUpdate(@RequestBody SalesHandRecode salesHandRecode) {
        salesHandRecodeService.addUpdate(salesHandRecode);
        return ApiResponse.success();
    }

    @ApiOperation(value = "del", notes = "删除伴手礼员工销售")
    @PostMapping("/del")
    @Login(permission = "SalesHandRecode:del")
    public ApiResponse<Object> del(@RequestBody Ids ids) {
        salesHandRecodeService.del(ids);
        return ApiResponse.success();
    }

    @ApiOperation(value = "delByTime", notes = "按时间删除伴手礼员工销售")
    @PostMapping("/delByTime")
    @Login(permission = "SalesHandRecode:delByTime")
    public ApiResponse<Object> delByTime(@RequestBody DatesVo datesVo) {
        salesHandRecodeService.delByTime(datesVo);
        return ApiResponse.success();
    }

    @ApiOperation(value = "getInfo", notes = "获取详情信息伴手礼员工销售")
    @GetMapping("/getInfo")
    @Login(permission = "SalesHandRecode:getInfo")
    public ApiResponse<SalesHandRecode> getPayInfo(@RequestParam Integer id) {
        return ApiResponse.success(salesHandRecodeService.getPayInfo(id));
    }
}
